package cn.com.msui.service.identity.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.msui.dao.identity.RoleDAO;
import cn.com.msui.domain.identity.Role;
import cn.com.msui.service.identity.RoleService;

@Service("roleService")
public class RoleServiceImpl extends RoleService {

	private RoleDAO roleDAO;

	public RoleDAO getRoleDAO() {
		return roleDAO;
	}

	@Autowired
	public void setRoleDAO(RoleDAO roleDAO) {
		this.roleDAO = roleDAO;
	}

	@Override
	public List<Role> getChildrenRoles(Role role) throws Exception {
		return roleDAO.selectChildrenRolesById(role);
	}

	@Override
	public void addRole(Role role) throws Exception {
		roleDAO.insertOneRole(role);
	}

	@Override
	public void modifyRole(Role role) throws Exception {
		roleDAO.updateOneRole(role);
	}

	@Override
	public void removeRole(Role role) throws Exception {
		roleDAO.deleteOneRole(role);
	}
}
